﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Media;

namespace VehicleRecordSystem.util
{
    class GUI
    {

        static string changed_color = "#EBA4B0", default_color = "#FFFFFFFF";

        public static void changeBackgroundColorToError(Object sender)
        {
            var bc = new BrushConverter();

            if (sender is TextBox)
            {
                TextBox tb = (TextBox)sender;
                tb.Background = (System.Windows.Media.Brush)bc.ConvertFrom(changed_color);
            }
            if (sender is DatePicker)
            {
                DatePicker dp = (DatePicker)sender;
                dp.Background = (System.Windows.Media.Brush)bc.ConvertFrom(changed_color);
            }
            if (sender is ComboBox)
            {
                ComboBox dp = (ComboBox)sender;
                dp.Background = (System.Windows.Media.Brush)bc.ConvertFrom(changed_color);
            }
        }
        public static void changeBackgroundColorToNormal(object sender)
        {
            var bc = new BrushConverter();

            if (sender is TextBox)
            {
                TextBox txt = (TextBox)sender;
                txt.Background = (System.Windows.Media.Brush)bc.ConvertFrom(default_color);
            }
            if (sender is DatePicker)
            {
                DatePicker dp = (DatePicker)sender;
                dp.Background = (System.Windows.Media.Brush)bc.ConvertFrom(default_color);
            }
            if (sender is ComboBox)
            {
                ComboBox dp = (ComboBox)sender;
                dp.Background = (System.Windows.Media.Brush)bc.ConvertFrom(default_color);
            }
        }
    }
}
